Correct bad math in read of gpsutil files.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 6 Aug 2002 04:29:46 +0000 (04:29 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 6 Aug 2002 04:29:46 +0000 (04:29 +0000)
gpsbabel/gpsutil.c

index 8e1dcf08483fdd75cd9ed2668f4c21bffbeee3a8..18a6886654005422c88f66e7e505efee58a5b0e5 100644 (file)
@@ -44,6 +44,7 @@ data_read(void)
        char name[9], desc[30];
        double lat,lon;
        char latdir, londir;
+       int ilat, ilon;
        long alt; 
        char alttype;
        char icon[3] = {0};
@@ -63,8 +64,13 @@ data_read(void)
 
                if (latdir == 'S') lat = -lat;
                if (londir == 'W') lon = -lon;
-               wpt_tmp->position.longitude.degrees = lon/100.0;
-               wpt_tmp->position.latitude.degrees = lat/100.0;
+
+               lat /= 100.0;
+               lon /= 100.0;
+               ilon = (int)(lon);
+               wpt_tmp->position.longitude.degrees = ilon + (lon - ilon)*(100.0/60.0);
+               ilat = (int)(lat);
+               wpt_tmp->position.latitude.degrees = ilat + (lat - ilat) * (100.0/60.0);
                wpt_tmp->icon_descr = strdup(icon);
 
                waypt_add(wpt_tmp);